package game;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JPanel;

public class StatisticsState extends JPanel implements WindowComponent{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private  JButton playButton;
	private  JButton optionButton;
	private  JButton leaderboardButton;
	private  JButton creditsButton;
	private  JButton logoutButton;

	public StatisticsState() {
		setLayout(null);
		initialize();
	}

	private void initialize() {
		
		playButton = new JButton("Play");
		playButton.setBounds(50, 520, 175, 45);
		playButton.setOpaque(false);
		playButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				FRAME.getContentPane().removeAll();
				FRAME.getContentPane().add(PLAY_PANEL).setVisible(true);
				STATISTICS_PANEL.setVisible(false);
				
			}
		});

		optionButton = new JButton("Option");
		optionButton.setBounds(500, 50, 275, 45);
		optionButton.setOpaque(false);
		optionButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				FRAME.getContentPane().removeAll();
				FRAME.getContentPane().add(OPTION_PANEL).setVisible(true);
				STATISTICS_PANEL.setVisible(false);
				
			}
		});
		
		creditsButton = new JButton("Credits");
		creditsButton.setBounds(500, 100, 275, 45);
		creditsButton.setOpaque(false);
		creditsButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				FRAME.getContentPane().removeAll();
				FRAME.getContentPane().add(CREDITS_PANEL).setVisible(true);
				STATISTICS_PANEL.setVisible(false);
				
			}
		});
		
		leaderboardButton = new JButton("Leaderboard");
		leaderboardButton.setBounds(300, 520, 175, 45);
		leaderboardButton.setOpaque(false);
		leaderboardButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				FRAME.getContentPane().removeAll();
				FRAME.getContentPane().add(LEADERBOARD_PANEL).setVisible(true);
				STATISTICS_PANEL.setVisible(false);
				
			}
		});
		
		logoutButton = new JButton("Logout");
		logoutButton.setBounds(500, 520, 175, 45);
		logoutButton.setOpaque(false);
		logoutButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				FRAME.getContentPane().removeAll();
				FRAME.getContentPane().add(MENU_PANEL).setVisible(true);
				STATISTICS_PANEL.setVisible(false);
				
			}
		});
		
		add(playButton);
		add(optionButton);
		add(creditsButton);
		add(leaderboardButton);
		add(logoutButton);
		
		
	}

}
